package com.example.heimaplayer.ui.activity

import androidx.appcompat.widget.Toolbar
import com.example.heimaplayer.R
import com.example.heimaplayer.base.BaseActivity
import com.example.heimaplayer.util.FragmentUtil
import com.example.heimaplayer.util.ToolBarManager
import kotlinx.android.synthetic.main.activity_main.*
import org.jetbrains.anko.find
import org.jetbrains.anko.toast


class MainActivity : BaseActivity(),ToolBarManager {
    override fun getLayoutId(): Int {
        return R.layout.activity_main
    }
//    顶部的菜单
    override val toolbar by lazy { find<Toolbar>(R.id.toolbar) }

    override fun initData() {
        super.initData()
        initMainToolBar()
    }

    override fun initListener() {
        super.initListener()
        bottomBar.setOnTabSelectListener{
            val begainTransaction = supportFragmentManager.beginTransaction()
            begainTransaction.replace(
                R.id.container,
                FragmentUtil.fragmentUtil.getFragemnt(it)!!,
                it.toString())
            begainTransaction.commit()
//            when(it){
//                R.id.tab_favorites ->toast("最左边tab_favorites")
//                  R.id.tab_center ->toast("中间")
//                R.id.tab_me ->toast("关于我的")
        }

    }

}